package offer;

import java.util.Arrays;
import java.util.List;

public class offerII_0035 {
    public int findMinDifference(List<String> timePoints) {
        int len=timePoints.size();
        int[] num=new int[len];
        int number=0;
        for(int i=0;i<len;++i){
            int sum=0;
            String  s=timePoints.get(i);
            sum+=(s.charAt(0)-'0')*10+(s.charAt(1)-'0');
            sum=sum*60+(s.charAt(3)-'0')*10+(s.charAt(4)-'0');
            num[number]=sum;
            sum=0;
            number++;
        }
        Arrays.sort(num);
        number=24*60;
        for(int i=0;i<len-1;++i){
            number=Math.min(number,num[i+1]-num[i]);
        }
        number=Math.min(number,num[0]+24*60-num[len-1]);
        return number;
    }
}
